import request from '@/utils/request'
/**
 * 商品信息-库存价格是否有效（支持本地购物车）
 * @param {*} id 商品skuId
 * @returns 
 */
export const updataLocalCart = (id) => {
    return request(`/goods/stock/${id}`, 'get')
}
/**
 * 商品信息-sku
 * @param {*} id skuId
 * @returns 
 */
export const goodsSku = (skuId) => {
    return request(`/goods/sku/${skuId}`, 'get')
}
/**
 * 
 * @param {*} cartList  参数对象
 *  @param {*}  skuId  skuId
 *  @param {*} selected 	是否选中
 *  @param {*}  count 	数量
 */
export const mergeCar = (cartList) => {
    return request('/member/cart/merge', 'post', cartList)
}
/**
 * 登陆后获取服务端购物车列表
 * @returns 
 */
export const getCarList = () => {
    return request('/member/cart', 'get',)
}
/**
 * 登录后加入购物车
 * @returns 
 */
export const postCarList = ({ skuId, count }) => {
    return request('/member/cart', 'post', { skuId, count })
}
/**
 * 删除登录后的购物车
 * @param {*} ids skuid
 * @returns 
 */
export const deleteCart = (ids) => {
    return request('/member/cart', 'delete', { ids })
}
/**
 * 更新服务端购物车数据
 * @param {*} id skuId
 * @returns 
 */
export const updataCart = ({ skuId, selected, count }) => {
    return request(`/member/cart/${skuId}`, 'put', { selected, count })
}
/**
 * 
 * @param {*} selected 全选按钮值
 * @param {*} ids skuId
 * @returns 
 */
export const checkAllCart = ({ selected, ids }) => {
    return request('/member/cart/selected', 'put', { selected, ids })
}
